<?php

@$text = $_REQUEST['text'];

$personSelectSql = 'select id,name,phone,qq from person';

$selectSqlWhere = " where name like concat('%',:text,'%')";

$personSelectData = array();

$selectSqlOrder = ' order by id asc';

if(!empty($text)){
	$personSelectSql .= $selectSqlWhere;
	$personSelectData['text'] = $text;
}

$personSelectSql .= $selectSqlOrder;

require 'lib/db.php';

@$persons = dbSelectAll($personSelectSql,$personSelectData);

echo json_encode(array('persons'=>$persons));